package com.woniu.liuzhougov.authorityControl.pojo;

import com.woniu.liuzhougov.authorityControl.verification.Register;
import com.woniu.liuzhougov.authorityControl.verification.SetDepartmentLeader;
import com.woniu.liuzhougov.itemAndTask.pojo.Area;
import com.woniu.liuzhougov.itemAndTask.pojo.Department;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

public class User {
    @NotNull(message = "用户id不能为空!",groups = {SetDepartmentLeader.class})
    private Integer userId;

    private UserStatus userStatus;
    @NotBlank(message = "用户名不能为空!", groups = {Register.class})
    private String userName;

    @NotBlank(message = "密码不能为空!", groups = {Register.class})
    @Pattern(message = "密码格式错误", regexp = "[A-Za-z0-9]{6,20}", groups = {Register.class})
    private String userPass;

    @NotBlank(message = "登录名不能为空!", groups = {Register.class})
    private String userLoginName;
    @NotBlank(message = "电话号码不能为空!", groups = {Register.class})
    @Pattern(message = "电话号码格式错误", regexp = "^1(3|4|5|7|8)\\d{9}$", groups = {Register.class})
    private String userPhone;

    @NotNull(message = "地区不能为空!", groups = {Register.class})
    @Valid
    private Area area;

    @NotNull(message = "部门不能为空!", groups = {Register.class})
    @Valid
    private Department department;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public UserStatus getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(UserStatus userStatus) {
        this.userStatus = userStatus;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPass() {
        return userPass;
    }

    public void setUserPass(String userPass) {
        this.userPass = userPass;
    }

    public String getUserLoginName() {
        return userLoginName;
    }

    public void setUserLoginName(String userLoginName) {
        this.userLoginName = userLoginName;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", userStatus=" + userStatus +
                ", userName='" + userName + '\'' +
                ", userPass='" + userPass + '\'' +
                ", userLoginName='" + userLoginName + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", area=" + area +
                ", department=" + department +
                '}';
    }
}